package org.jeecg.modules.exPingbiao.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.exPingbiao.service.IExPingbiaoExpertRecordService;
import org.jeecg.modules.exPingbiao.vo.ExPingbiaoConformanceReview;
import org.jeecg.modules.exTenderFile.vo.ScoreChapterTree;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "专家评标记录")
@RestController
@RequestMapping("/exPingbiao/exPingbiaoExpertRecord")
@Slf4j
public class ExPingbiaoExpertRecordController {
    @Autowired
    private IExPingbiaoExpertRecordService exPingbiaoExpertRecordService;


    @ApiOperation(value = "符合性审查项全部投标人评分记录", notes = "符合性审查项全部投标人评分记录")
    @GetMapping(value = "/getConformanceReviewRecord")
    public Result<ExPingbiaoConformanceReview> getConformanceReviewRecord(@RequestParam(name = "conformanceReviewId") String conformanceReviewId, @RequestParam(name = "expertId",required = false) String expertId) {
        return Result.OK(exPingbiaoExpertRecordService.getConformanceReviewRecord(conformanceReviewId, expertId));
    }
    @ApiOperation(value = "符合性审查项全部专家评分记录", notes = "符合性审查项全部专家评分记录")
    @GetMapping(value = "/getConformanceReviewExpertRecord")
    public Result<ExPingbiaoConformanceReview> getConformanceReviewExpertRecord(@RequestParam(name = "conformanceReviewId") String conformanceReviewId, @RequestParam(name = "tenderListId") String tenderListId) {
        return Result.OK(exPingbiaoExpertRecordService.getConformanceReviewExpertRecord(conformanceReviewId, tenderListId));
    }

    /**
     * @param tenderListId 投标人ID
     * @param businessId   具体的业务ID，对应realBusinessId
     * @param businessType 业务类型：综合指标、技术指标
     * @param sectionId    标段ID 非必填
     * @return
     */
    @ApiOperation(value = "根据投标人人查询所有专家的评分记录", notes = "根据评标人查询所有专家的评分记录")
    @GetMapping(value = "/queryExpertPfRecordByTender")
    public Result<List<ScoreChapterTree>> queryExpertPfRecordByTender(String tenderListId, String businessId, String businessType, @RequestParam(required = false) String sectionId) {
        return Result.ok(exPingbiaoExpertRecordService.queryPfRecordByExpertOrTender(sectionId, null, tenderListId, businessId, businessType));
    }

    /**
     * @param expertId     专家ID
     * @param businessId   具体的业务ID，对应realBusinessId
     * @param businessType 业务类型：综合指标、技术指标
     * @param sectionId    标段ID 非必填
     * @return
     */
    @ApiOperation(value = "根据专家获取投标人的记录", notes = "评标-根据专家获取投标人的记录")
    @GetMapping(value = "/queryTenderPfRecordByExpert")
    public Result<List<ScoreChapterTree>> queryTenderPfRecordByExpert(String expertId, String businessId, String businessType, @RequestParam(required = false) String sectionId) {
        return Result.ok(exPingbiaoExpertRecordService.queryPfRecordByExpertOrTender(sectionId,expertId, null, businessId, businessType));
    }
    /**
     * @param businessId   具体的业务ID，对应realBusinessId
     * @param businessType 业务类型：综合指标、技术指标
     * @param sectionId    标段ID 非必填
     * @return
     */
    @ApiOperation(value = "查询投标人评分分数汇总", notes = "评标-查询投标人评分分数汇总")
    @GetMapping(value = "/queryTenderPfSum")
    public Result<List<ScoreChapterTree>> queryTenderPfSum(String businessId, String businessType, @RequestParam(required = false) String sectionId) {
        return Result.ok(exPingbiaoExpertRecordService.queryTenderPfSum(sectionId,  businessId, businessType));
    }

}
